package test

import junit.framework.TestCase

import java.lang.reflect.Field
import bankofficegrepper.BankInfo

/**
 * Created by IntelliJ IDEA.
 * User: janexie
 * Date: 2010-11-24
 * Time: 21:24:29
 * To change this template use File | Settings | File Templates.
 */

public class RetrieveDataTestCase extends TestCase {
  public void testRetriveData() throws Exception {
    def records = new XmlSlurper().parseText(bankInfoString)
    List list = []
    def bankInfoRows = records.body.form.div.table.tbody.tr.td.table.tbody.tr[1].td.table.tbody.tr
      bankInfoRows= bankInfoRows[1..bankInfoRows.size()-1]
    bankInfoRows.each {
      def bankInfoRow = it.td
      BankInfo info = new BankInfo();
      info.province = bankInfoRow[0]
      info.city = bankInfoRow[1]
      info.type = bankInfoRow[2]
      info.name = bankInfoRow[3]
      info.address = bankInfoRow[4]
      info.telephoneNo = bankInfoRow[5]
      list += info
    }
    println list.size()
    list.each {
      println 'Province: ' + it.getProvince() + ' City: ' + it.getCity() + ' Name :' + it.getName() + ' Address: ' + it.getAddress();
    }
  }

  def bankInfoString = """
      <html>
       	<head>
	<title>
	?��????????��????
	</title>
	<link rel="stylesheet" type="text/css" href="\\icbc\\Optimize\\res\\common.css" dir="rtl"/>
</head>
<body marginwidth="0">
	<form name="form1" method="post" action="SiteinfoListIframe.aspx?siteArea=AreaInfo%3b2e7114ec-323c-4954-8e3f-38f4ba2a5ff0&amp;CityId=&amp;siteStyle=&amp;site_KeyWord=&amp;pageNETSITE=2" id="form1">
		<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTAxMjU0ODYwNmRkEkna4/p1p5MEXY6GOOj+jXF458A="/>

			<div>
				<table cellspacing="0" cellpadding="0" width="100%">
					<tbody>
						<tr>
							<td align="center">
								<link rel="stylesheet" type="text/css" href="\\icbc\\Optimize\\res\\common.css" dir="rtl"/>
									<table cellspacing="0" cellpadding="0" border="0" style="width:750px;border-collapse:collapse;word-break:break-all;word-wrap:break-word">
										<tbody>
											<tr>
												<td valign="bottom" colspan="100">
													<table cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;word-break:break-all;word-wrap:break-word">
														<tbody>
															<tr>
																<td class="tdCommonTableHeader" align="right" valign="bottom" style="height:12px;width:100%;">?????????????565?????</td>
															</tr>
														</tbody>
													</table>
												</td>
											</tr>
											<tr>
												<td valign="top" colspan="100">
													<table class="tableDataTableAsset" cellspacing="0" cellpadding="0" border="0" style="border-style:Solid;width:100%;border-collapse:collapse;word-break:break-all;word-wrap:break-word">
														<tbody>
											<tr style="background-color:#E8E8E8;font-weight:bold;height:25px;">
				<td class="HeadRowCSSOne" align="center" valign="middle" style="width:10%;">地区</td><td class="HeadRowCSSOne" align="center" valign="middle" style="width:10%;">城市</td><td class="HeadRowCSSOne" align="center" valign="middle" style="width:13%;">服务种类</td><td class="HeadRowCSSOne" align="left" valign="middle" style="width:17%;">网点名称</td><td class="HeadRowCSSOne" align="left" valign="middle" style="width:17%;">网点地址</td><td class="HeadRowCSSOne" align="left" valign="middle" style="width:12%;">联系电话</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安庆市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行安庆中兴大街分理处</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">安庆市中兴大街恒祥公寓底层</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0556)5323004</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠朝阳支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市朝阳路367号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2055986</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠车站支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市交通路257号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)3077959</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠大桥支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市解放四路110号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)3041011</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠大庆路支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市大庆路173号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)4087268</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠二马路支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市凤阳西路436号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2081050</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠凤阳路第二支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市凤阳西路259号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)3080027</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠工农路支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市工农路与红旗路交叉口</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)4021393</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠公园支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市张公山路2号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)4955033</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠河北新区支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市小蚌街十字路口北13米</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2827115</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠宏业村支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市宏业路117号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)3132021</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠华夏支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市涂山路2222号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)4040030</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠淮河支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市胜利西路1号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2065210</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠汇通支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市胜利东路1511号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2078632</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠龙湖香都支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市曹凌路971号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)3114456</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠明珠支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市涂山路155号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)4013572</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠三马路支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市延安路3号区4号楼3单元1楼</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)3080012</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠升平支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市南山路336号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2081078</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠胜利路支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市胜利东路1599号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2081012</td>
			</tr><tr style="height:30px;">
				<td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">安徽省</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">蚌埠市</td><td class="DataRowCSSOne" align="center" valign="middle" style="width:10%;">对公,对私,自动柜员机</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">中国工商银行蚌埠体育路支行</td><td class="DataRowCSSOne" align="left" valign="middle" style="width:18%;">蚌埠市体育路70号</td><td class="LastDataRowCSSOne" align="left" valign="middle" style="width:12%;">(0552)2056025</td>
			</tr>
														</tbody>
													</table>
												</td>
											</tr>
											<tr style="height:30px;">
												<td class="tdCommonTablePage" align="right" valign="top" colspan="100">
													<div>
														<table width="100%">
															<tbody>
																<tr style="width:100%">
																	<td style="width:100%" align="right">

																		<a href="/ICBCDynamicSite/Optimize/SiteInfo/SiteinfoListIframe.aspx?&amp;siteArea=AreaInfo;2e7114ec-323c-4954-8e3f-38f4ba2a5ff0&amp;CityId=&amp;siteStyle=&amp;site_KeyWord=&amp;pageNETSITE=1" target="_self" class="text2">?? ?</a>  ??
																		<a href="/ICBCDynamicSite/Optimize/SiteInfo/SiteinfoListIframe.aspx?&amp;siteArea=AreaInfo;2e7114ec-323c-4954-8e3f-38f4ba2a5ff0&amp;CityId=&amp;siteStyle=&amp;site_KeyWord=&amp;pageNETSITE=1" target="_self" class="text2">????</a>  ??
																		<a href="/ICBCDynamicSite/Optimize/SiteInfo/SiteinfoListIframe.aspx?&amp;siteArea=AreaInfo;2e7114ec-323c-4954-8e3f-38f4ba2a5ff0&amp;CityId=&amp;siteStyle=&amp;site_KeyWord=&amp;pageNETSITE=3" target="_self" class="text2">????</a>  ??
																		<a href="/ICBCDynamicSite/Optimize/SiteInfo/SiteinfoListIframe.aspx?&amp;siteArea=AreaInfo;2e7114ec-323c-4954-8e3f-38f4ba2a5ff0&amp;CityId=&amp;siteStyle=&amp;site_KeyWord=&amp;pageNETSITE=29" target="_self" class="text2">? ?</a>        ?? 29 ?    ?? 2 ?
																	</td>
																	<td style="width:100%" align="right">    ??</td>
																	<td style="WIDTH: 100%" align="right">
																		<input name="pageNETSITE" type="text" value="" onpaste="return false;" onkeypress="return LimitOnlyInputInt();" style="ime-mode:disabled;width:30px;height:12px;" maxlength="10"/>
																	</td>
																	<td style="WIDTH: 100%" align="right">?</td>
																	<td style="WIDTH: 100%" align="right">
																		    <input name="gopage" type="button" class="SMALLBTN_IMG_OK" value="" style="width:30px; text-align:center" onclick="go();"/>
    </td>
																</tr>
															</tbody>
														</table>
													</div>
												</td>
											</tr>
										</tbody>
									</table>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
	</form>
</body>
</html>
"""
}